<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title>后台管理系统</title>
	    <meta name="author" content="BaiYY"/>
	    <meta charset="utf-8">
	    <meta http-equiv="X-UA-Compatible" content="IE=edge">
	    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
	    <meta name="renderer" content="webkit">
	    <link rel="stylesheet" type="text/css" href="__PUBLIC__/admin/css/bootstrap.min.css"/>
	    <link rel="stylesheet" type="text/css" href="__PUBLIC__/admin/css/Font/css/font-awesome.min.css"/>
	    <link rel="stylesheet" type="text/css" href="__PUBLIC__/admin/css/index.css"/>
	    <link rel="stylesheet" type="text/css" href="__PUBLIC__/admin/css/pages.css"/>
	    <script type="text/javascript" src="__PUBLIC__/admin/js/jquery.js"></script>
	    <script type="text/javascript" src="__PUBLIC__/admin/js/bootstrap.min.js"></script>
	    <script type="text/javascript" src="__PUBLIC__/admin/js/index.js"></script>
	    <script type="text/javascript" src="__PUBLIC__/admin/js/time.js"></script>
	    <script type="text/javascript" src="__PUBLIC__/admin/js/pages.js"></script>
	</head>
	<body>
		
		<!--右边侧栏开始-->
		<div class="right-sidebar" style="max-width: 1200px;">
			<if condition='$role gt 90'>
				<ul class="nav nav-tabs" style="margin-bottom: 16px" role="tablist">
					<li role="presentation"><a href="pay.html">充值{:L('GAME_RESOURCE')}</a></li>
					<li role="presentation"><a href="payList.html">充值记录</a></li>
					<li role="presentation" class="active"><a href="paySearch.html">充值搜索</a></li>
				</ul>
			</if>
			
			<div class="input-group" style="margin-top: 10px;">
				<input type="text" class="form-control" placeholder="请输入被充值者的ID" name="search" id="search">
				<span class="input-group-btn">
					<button class="btn btn-default" type="button" id="btn">&emsp;搜索&emsp;</button>
				</span>
			</div>
		
			<br />
			
			<div class="table-responsive">
				<table class="table table-bordered" id="list">
					<thead>
						<tr id="head">
							<th>充值编号</th>
							<th>充值者ID</th>
							<th>被充值者ID</th>
							<th>充值金额</th>
							<th>充值状态</th>
							<th>时间</th>
						</tr>
					</thead>
					<tbody></tbody>
				</table>
			</div>
			<ul class="page" id="page" style="width: 100%;overflow: hidden;"></ul>
			<div style="margin: 10px auto;display: none" id="exports" ><a class="btn btn-primary" onclick="handel(this)">全部导出excel</a></div>
		</div>
		<script type="text/javascript">
			$("#btn").on("click",function(){
				var search = $("#search").val();
				if($.trim($('#search')) == '' || isNaN($.trim(search))) {
					alert("玩家ID不正确，请重新输入！");
					$("#search").val('');
					return false;
				}
				$.ajax({
					type:"post",
					url:"{:U('Admin/Main/paySearchCheck')}",
					dataType:"json",
					data:{'search':search},
					success:function(datas) {
						if(datas != 'false' && datas) {
							options={
								"id":"page",//显示页码的元素
								"data":datas,//显示数据
							    "maxshowpageitem":2,//最多显示的页码个数
							    "pagelistcount":10,//每页显示数据个数
							    "callBack":function(data){
							    	var str = "";
									var txt = '';
									for(var i=0;i<data.length;i++) {
										
										if(data[i].status == 1) {
											txt = "成功";
										}else if(data[i].status == 0){
											txt = "失败";
										}else{
											txt = "待处理";
										}
										var time = getLocalTime(data[i].add_time);
										str += "<tr><td>"+data[i].id+"</td><td>"+data[i].user_id+"</td><td>"+data[i].uid+"</td><td>"+data[i].number+"</td><td>"+txt+"</td><td>"+time.toLocaleString()+"</td></tr>";
										$("#exports").show();
									}
									$("#list tbody").html(str);
						    	}
							}
							page.init(datas.length,1,options);
						}else{
							alert("抱歉！暂时没有查到任何数据!");
							window.location.href="{:U('Admin/Main/paySearch')}";
						}
					}
				});
			});
			function handel(This) {
				var user_id = $("#search").val();
				$(This).prop('href',"{:U('Admin/Main/payExport')}?user_id="+user_id);
            }
		</script>
	</body>
</html>

